<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div class="erweima hide" id="er">
  <script>
    // 获取元素
    var box = document.getElementById("er");
    // 元素自有属性
    console.log(er.id);
    
    er.setAttribute("class","demo");
  </script>
</body>
</html>